package com.hqyj.util;

import org.apache.shiro.crypto.hash.Md5Hash;
import org.apache.shiro.crypto.hash.SimpleHash;
import org.springframework.stereotype.Component;

@Component
public class MdFive {

    public static void main(String[] args) {
        MdFive mdFive = new MdFive();
        System.out.println(mdFive.encrypt("123", "admin"));

    }

    /**
     * @param password  要加密的密码
     * @param saltValue 盐值
     * @return
     */
    public Object encrypt(String password, String saltValue) {
            Object salt = new Md5Hash(saltValue);
            Object result = new SimpleHash("MD5", password, salt, 1024);
            return result;
    }
}
